<?php
namespace addon\notice\validate;
use app\common\validate\ValidateBase;
class Notice extends ValidateBase
{
    // 验证规则
    protected $rule = [
        'title'                 => 'require',
        'key'                   => 'require|alpha|length:3,18',
        'content'               => 'require'
    ];

    // 验证提示
    protected $message = [
        'title.require'         => '公告标题不能为空',
        'key.require'           => '公告标识必须',
        'key.alpha'             => '公告标识由字母组成',
        'key.length'            => '公告标识长度3-18位'
    ];

    // 应用场景
    protected $scene = [
        'add'  =>  ['title','key'],
    ];
}